<?php

namespace App\Models;

class PointsLog extends Model
{
    protected $table = 'yf_points_log';
    protected $primaryKey = 'points_log_id';
    public $timestamps = false;
    protected $guarded = ['points_log_id'];

    public static function isTodaySignIn(int $userId) : bool
    {
        return self::whereDate('points_log_time', now()->toDateString())
            ->whereUserId($userId)
            ->wherePointsLogFlag('login')
            ->exists();
    }
}
